//
//  UIView+IBExtension.swift
//  sinaWeibo
//
//  Created by jixiao on 15/12/27.
//  Copyright © 2015年 heimacast. All rights reserved.
//

import UIKit

//分类方法
extension UIView {
    
    @IBInspectable var cornerRadius:CGFloat{
        
        get{
            
            return layer.cornerRadius
            
        }
    
        set{
            
            layer.cornerRadius=newValue
            
            layer.masksToBounds=(newValue>0)
            
        }
    
    }
    
    //边线宽度
    @IBInspectable var borderWidth:CGFloat{
        
        
        get{
            
            return layer.borderWidth
        }
        
        set{
            
            layer.borderWidth=newValue
            
        }
        
    }
    
    //边线颜色
    
    @IBInspectable var borderColor:UIColor?{
        
        get{
            
            guard let c=layer.borderColor else{
                
                return nil
            }
            
            return UIColor(CGColor: c)
        }
        
        
        set{
            
            layer.borderColor=newValue?.CGColor
            
        }
        
        
        
    }
    
    
    
    
}
